//
//  TreeEntity.m
//  SpaceViking
//
//  Created by gnt on 12/13/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "TreeEntity.h"
#import "GameplayLayer.h"


@implementation TreeEntity
@synthesize currentZ;
@synthesize currentZMapIndex;
@synthesize unshiftX;
@synthesize unshiftY;
@synthesize existedTurn;


//int damage;
//float actualDuration = 1;
//Boolean canScale = true;
//int increaseUpdate;


-(id) initWithType:(TreeTypes)treeType
{
	type = treeType;
	existedTurn = STRIGHT;
    
	NSString* treeFrameName;
	
	switch (type)
	{
		case TreeType0:
			treeFrameName = @"tree1.png";
			break;
		case TreeType1:
			treeFrameName = @"tree2.png";
			break;
		case TreeType2:
			treeFrameName = @"tree3.png";
			break;
        case TreeType3:
			treeFrameName = @"small_grass.png";
			break;
        case StoneType1:
            treeFrameName = @"rock1.png";
            break;
        case StoneType2:
            treeFrameName = @"rock2.png";
            break;
            
		default:
			[NSException exceptionWithName:@"EnemyEntity Exception" reason:@"unhandled enemy type" userInfo:nil];
	}
    
	if (self = [super initWithSpriteFrameName:treeFrameName]) {
        self.visible = NO;
        self.anchorPoint = ccp(0.5f, 0);
    }
        
	return self;
}


+(id) treeWithType:(TreeTypes)treeType
{
	return [[[self alloc] initWithType:treeType] autorelease];
}


-(void) dealloc
{
	[super dealloc];
}

@end